<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学生管理--我的试卷</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="stylesheet" href="assets/css/gb_my.css">
    <link rel="stylesheet" href="assets/css/font-awesome.css">
    <link rel="stylesheet" href="assets/css/bootstrap-reset.css">
    <link rel="stylesheet" href="assets/css/easydropdown.css">
</head>
<body data-type="chart">
<div class="am-g tpl-g">
    <!--头部-->
    <nav class="navbar navbar-default top-navbar">
        <div class="navbar-header">
            <a class="navbar-brand waves-effect waves-dark" href="javascript:;">
                <img src="assets/img/logo.png" alt="">
                <strong>轻课网考试系统</strong>
            </a>
            <div id="sideNav" href="">
                <i class="mulv QK QK-mulu"></i>
            </div>
        </div>
        <ul class="nav navbar-top-links navbar-right aaa">
            <li>
                <a id="down_" class="sign-out dropdown-button waves-effect waves-dark" href="javascript:;">
                    <span class="am-icon-sign-out"></span> 退出
                </a>
            </li>
            <li>
                <a class="dropdown-button waves-effect waves-dark" href="javascript:;"><b>欢迎你, <span class="userName"></span> </b></a>
            </li>
        </ul>
    </nav>
    <!--导航栏-->
    <nav class="navbar-default navbar-side">
        <div class="sidebar-collapse">
            <!--用户头像-->
            <div class="tpl-sidebar-user-panel">
                <div class="tpl-user-panel-slide-toggleable">
                    <div class="tpl-user-panel-profile-picture">
                        <img src="assets/img/user04.png" alt="">
                    </div>
                </div>
            </div>
            <dl class="list_dl">
                <dt class="list_dt">
                    <a href="index.html">
                        <span class="QK1 start_before"></span>
                        <p>学生平台</p>
                    </a>
                </dt>
                <dt id="open" class="list_dt">
                    <span class="QK1 topic_before"></span>
                    <p>我的考试</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd" style="display: block">
                    <ul>
                        <li class="list_li" id="style_li_a">
                            <a href="student.html">我的试卷</a>
                        </li>
                        <li class="list_li">
                            <a href="examRecords.html">考试记录</a>
                        </li>
                    </ul>
                </dd>
                <dt class="list_dt">
                    <span class="QK1 paper_before"></span>
                    <p>自我检测</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="testing.html">自我检测</a>
                        </li>
                        <li class="list_li">
                            <a href="error.html">检测结果</a>
                        </li>
                    </ul>
                </dd>
                <dt class="list_dt">
                    <span class="QK1 user_before"></span>
                    <p>个人管理</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="personalData.html">个人资料</a>
                        </li>
                        <li class="list_li">
                            <a href="collection.html">题目收藏</a>
                        </li>
                    </ul>
                </dd>
                <dt class="list_dt">
                    <span class="QK1 chat_before"></span>
                    <p>聊天室</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="chatroom.html">聊天室</a>
                        </li>
                    </ul>
                </dd>
            </dl>
        </div>
    </nav>
    <!-- 内容区域 -->
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <span class="label label-primary">
							我的试卷
						</span>
                    </header>
                    <div class="panel-body">
                        <section id="unseen">
                            <table width="100%" class="table table-bordered table-striped table-condensed" id="example-r">
                                <thead>
                                <tr>
                                    <th>试卷名称</th>
                                    <th>创建人</th>
                                    <th>参考人数</th>
                                    <th>起始时间</th>
                                    <th>终止时间</th>
                                    <th>总时长</th>
                                    <th>状态</th>
                                    <th>总分</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="wraper">

                                </tbody>
                            </table>
                            <div class="loading">
                                <span></span>
                                <span></span>
                                <span></span>
                                <span></span>
                                <span></span>
                            </div>
                        </section>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/theme.js"></script>
<script src="assets/js/easydropdown.js"></script>
<script src="assets/js/html5sv.js"></script>
<script type="text/javascript" src="assets/js/jquery.cookie.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/amazeui.datatables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<script src="assets/js/student.js"></script>
<script>
    $('.loading').css('display' , 'block');
    $(document).ready(function () {
        var storage = window.localStorage;
        var user_id = storage["uid"];
        var class_id = storage["class_id"];
//        console.log(user_id);
//        console.log(class_id);
        function p(s) {
            return s < 10 ? '0' + s: s;
        }
        //获取当前的时间
        var myDate = new Date();
        //获取当前年
        var year=myDate.getFullYear();
        //获取当前月
        var month=myDate.getMonth()+1;
        //获取当前日
        var date=myDate.getDate();
        var hour = myDate.getHours(); //获取当前小时数(0-23)
        var minute = myDate.getMinutes(); //获取当前分钟数(0-59)
        var second = myDate.getSeconds(); //获取当前秒数(0-59)

        var now = year + '-' + p(month) + "-" + p(date) + " " + p(hour) + ":" + p(minute) + ":" + p(second);
//        console.log(now);
        var date_now= new Date(Date.parse(now.replace(/-/g,   "/")));
//        console.log(date_now);
        $.ajax({
            url: localApi + "/Paper/getNowExam",
            type: 'get',
            data: {
                apikey: '1',
                id:class_id,
                uid:user_id,
                nowTime:date_now
            },
            success:function (result) {
                console.log(result);
                var stauts,
                pid;
                if(result.data == 'error'){
                    $('.loading').css('display' , 'none');
                    $('.panel-body').empty();
                    var add_empty = '<p>暂无考试试卷！！！</p>';
                    $('.panel-body').append(add_empty);
                    $('.panel-body').addClass('add_empty_style');
                }else{
                    $('.loading').css('display' , 'none');
                    $.each(result.data , function (n , item) {
                        if(item.status == '-1'){
                            stauts = '不开放';
                        }else{
                            stauts = '开放';
                        }
                        var test_every = '<tr class="even gradeX student">\n' +
                            '                  <td>'+ item.paperName +'</td>\n' +
                            '                  <td class="adminid' + item.adminid + '"></td>\n' +
                            '                  <td class="count' + item.id + '"></td>\n' +
                            '                  <td><p>' + item.starttime + '</p></td>\n' +
                            '                  <td><p>' + item.endtime + '</p></td>\n' +
                            '                  <td>' + item.paperMinute + '</td>\n' +
                            '                  <td>'+ stauts +'</td>\n' +
                            '                  <td>'+ item.totalScore +'分</td>\n' +
                            '                  <td class="operation">\n' +
                            '                    <div class="tpl-table-black-operation">\n' +
                            '                      <a id="begin_btn'+ item.id +'" href="doTopic.html?pid='+ item.id +'&pScore='+ item.totalScore +'" class="begin_btn studentDo button button--aylen"><i class="QK1 QK-bianji"></i>开始做题</a>\n' +
                            '                    </div>\n' +
                            '                  </td>\n' +
                            '           </tr>';
                        $('#wraper').append(test_every);
                    });
                    $('.begin_btn').click(function () {
                        var this_id = $(this).attr('id').split('btn')[1];
                        $.ajax({
                            url: localApi + "/ExamInfo/add",
                            type: 'post',
                            data: {
                                apikey: '1',
                                uid:user_id,
                                pid:this_id
                            },
                            success:function (result) {

                            }
                        })
                    });
                }
            }
        })
    });
</script>
<script>
    $(document).ready(function() {
        $(".list_dt").on("click", function() {
            $('.list_dd').stop();
            $(this).siblings("dt").removeAttr("id");
            if($(this).attr("id") == "open") {
                $(this).removeAttr("id").siblings("dd").slideUp();
            } else {
                $(this).attr("id", "open").next().slideDown().siblings("dd").slideUp();
            }
        });
    });
</script>
<script>
    $(document).ready(function() {
        $(".dropdown-button").dropdown();
        $("#sideNav").click(function() {
            if($(this).hasClass('closed')) {
                $('.navbar-side').animate({
                    left: '0px'
                });
                $(this).removeClass('closed');
                $('#page-wrapper').animate({
                    'margin-left': '260px'
                });
            } else {
                $(this).addClass('closed');
                $('.navbar-side').animate({
                    left: '-260px'
                });
                $('#page-wrapper').animate({
                    'margin-left': '0px'
                });
            }
        });
    });
    $(".dropdown-button").dropdown();
</script>